
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>更强大和方便的功能--注解 · Java笔记Blog</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="snowdreams1006">
        
        
    
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-timeline/timeline.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="java14.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://blog.lichongbing.com/" target="_blank" class="custom-link">blog</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="java5.html">
            
                <a href="java5.html">
            
                    
                    Java基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="java.html">
            
                <a href="java.html">
            
                    
                    Java知识思维导图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="java5.html">
            
                <a href="java5.html#2">
            
                    
                    Java开发环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="java5.html">
            
                <a href="java5.html#21">
            
                    
                    1.1 Java开发环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="java5.html">
            
                <a href="java5.html#22">
            
                    
                    1.2 安装Java开发工具箱
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="java6.html">
            
                <a href="java6.html#3">
            
                    
                    Java程序要素概览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="java7.html">
            
                <a href="java7.html">
            
                    
                    Java编程基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="java8.html">
            
                <a href="java8.html">
            
                    
                    基础编程元素--运算符 表达式 语句与流程控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="java9.html">
            
                <a href="java9.html">
            
                    
                    常用的数据结构--数组与枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="java10.html">
            
                <a href="java10.html">
            
                    
                    面向对象设计的核心--类与对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="java11.html">
            
                <a href="java11.html">
            
                    
                    重复调用的代码块--方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="java12.html">
            
                <a href="java12.html">
            
                    
                    面向对象设计的精华--类的封装 继承 多态
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.9.1" data-path="java12.html">
            
                <a href="java12.html#1">
            
                    
                    8.1 面向对象的三大特点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.2" data-path="java12.html">
            
                <a href="java12.html#4">
            
                    
                    8.2 封装的实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.3" data-path="java12.html">
            
                <a href="java12.html#7">
            
                    
                    8.3 继承的实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.4" data-path="java12.html">
            
                <a href="java12.html#8">
            
                    
                    8.4 深度认识类的继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.5" data-path="java12.html">
            
                <a href="java12.html#9">
            
                    
                    8.5 覆写
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.6" data-path="java12.html">
            
                <a href="java12.html#12">
            
                    
                    8.6 多态的实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.7" data-path="java12.html">
            
                <a href="java12.html#10">
            
                    
                    8.7 高手点拨
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.8" data-path="java12.html">
            
                <a href="java12.html#11">
            
                    
                    8.8 实战练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="java13.html">
            
                <a href="java13.html">
            
                    
                    凝练才是美--抽象类 接口 内部类
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.10.1" data-path="java13.html">
            
                <a href="java13.html#1">
            
                    
                    9.1 抽象类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.2" data-path="java13.html">
            
                <a href="java13.html#2">
            
                    
                    9.2 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.3" data-path="java13.html">
            
                <a href="java13.html#3">
            
                    
                    9.3 内部类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.4" data-path="java13.html">
            
                <a href="java13.html#4">
            
                    
                    9.4 匿名内部类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.5" data-path="java13.html">
            
                <a href="java13.html#5">
            
                    
                    9.5 匿名对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.6" data-path="java13.html">
            
                <a href="java13.html#6">
            
                    
                    9.6 高手点拨
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.7" data-path="java13.html">
            
                <a href="java13.html#7">
            
                    
                    9.7 实战练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="java14.html">
            
                <a href="java14.html">
            
                    
                    更灵活的设计--泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.12" data-path="java15.html">
            
                <a href="java15.html">
            
                    
                    更强大和方便的功能--注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" >
            
                <span>
            
                    
                    设计实践--常用的设计模式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" >
            
                <span>
            
                    
                    存储类的仓库--Java常用类库
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" >
            
                <span>
            
                    
                    防患未然--异常的捕获与处理
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" >
            
                <span>
            
                    
                    齐头并进，并发任务的处理--多线程
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.17" >
            
                <span>
            
                    
                    文件I/O操作
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.18" >
            
                <span>
            
                    
                    Java反射
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.19" >
            
                <span>
            
                    
                    数据持久化方法--对象序列化
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.20" >
            
                <span>
            
                    
                    Maven Git Linux的基础使用
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="java6.html">
            
                <a href="java6.html">
            
                    
                    JavaWeb基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" >
            
                <span>
            
                    
                    JavaWeb的服务器与ide工具
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" >
            
                <span>
            
                    
                    JSP基本语法
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" >
            
                <span>
            
                    
                    JSP内置对象
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" >
            
                <span>
            
                    
                    JavaBean技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" >
            
                <span>
            
                    
                    Servlet技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" >
            
                <span>
            
                    
                    文件的上传与下载
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" >
            
                <span>
            
                    
                    过滤器和监听器
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" >
            
                <span>
            
                    
                    JavaWeb的数据库操作
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" >
            
                <span>
            
                    
                    EL表达式语言
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" >
            
                <span>
            
                    
                    JSTL标签
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    JavaWeb前端
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" >
            
                <span>
            
                    
                    HTML与CSS网页开发基础
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" >
            
                <span>
            
                    
                    JavaScript脚本语言
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" >
            
                <span>
            
                    
                    Ajax技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" >
            
                <span>
            
                    
                    JQuery技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" >
            
                <span>
            
                    
                    JSON技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" >
            
                <span>
            
                    
                    Java正则表达式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" >
            
                <span>
            
                    
                    Vue.js
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" >
            
                <span>
            
                    
                    BootStap框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" >
            
                <span>
            
                    
                    Flutter框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" >
            
                <span>
            
                    
                    Angular框架 
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" >
            
                <span>
            
                    
                    webpack
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" >
            
                <span>
            
                    
                    微信小程序
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    JavaWeb数据库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    MySQL
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" >
            
                <span>
            
                    
                    JDBC
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" >
            
                <span>
            
                    
                    C3P0
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" >
            
                <span>
            
                    
                    Druid
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    JavaWeb强化
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" >
            
                <span>
            
                    
                    设计模式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" >
            
                <span>
            
                    
                    JVM优化
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" >
            
                <span>
            
                    
                    数据结构算法
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" >
            
                <span>
            
                    
                    多线程高级
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" >
            
                <span>
            
                    
                    MINA
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" >
            
                <span>
            
                    
                    Netty
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" >
            
                <span>
            
                    
                    NIO
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    JavaWeb框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" >
            
                <span>
            
                    
                    Struct2框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" >
            
                <span>
            
                    
                    JPA
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" >
            
                <span>
            
                    
                    Spring Data
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" >
            
                <span>
            
                    
                    Hibemate技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" >
            
                <span>
            
                    
                    Spring核心之IoC
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" >
            
                <span>
            
                    
                    Spring核心之AOP
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" >
            
                <span>
            
                    
                    Spring MVC框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" >
            
                <span>
            
                    
                    Mybatis框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" >
            
                <span>
            
                    
                    Mybatis Plus
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                    JavaWeb业务解决方案
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" >
            
                <span>
            
                    
                    ElasticSearch
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" >
            
                <span>
            
                    
                    Kibana
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" >
            
                <span>
            
                    
                    Logstash
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" >
            
                <span>
            
                    
                    LOG4J
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" >
            
                <span>
            
                    
                    Logback
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" >
            
                <span>
            
                    
                    SLF4J
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" >
            
                <span>
            
                    
                    Solr
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" >
            
                <span>
            
                    
                    D3
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" >
            
                <span>
            
                    
                    JCL
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" >
            
                <span>
            
                    
                    AntV
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.11" >
            
                <span>
            
                    
                    Beats
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.12" >
            
                <span>
            
                    
                    Lucene
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.13" >
            
                <span>
            
                    
                    POI
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.14" >
            
                <span>
            
                    
                    FreeMaker
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.15" >
            
                <span>
            
                    
                    Thymeleaf
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.16" >
            
                <span>
            
                    
                    Shiro
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.17" >
            
                <span>
            
                    
                    Spring Security
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.18" >
            
                <span>
            
                    
                    JasperReport
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.19" >
            
                <span>
            
                    
                    Quartz
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.20" >
            
                <span>
            
                    
                    Elastic-Job
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.21" >
            
                <span>
            
                    
                    Activiti
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.22" >
            
                <span>
            
                    
                    微信支付
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.23" >
            
                <span>
            
                    
                    支付宝支付
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.24" >
            
                <span>
            
                    
                    百度地图
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.25" >
            
                <span>
            
                    
                    高德地图
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" >
            
                <span>
            
                    
                    JavaWeb中介组件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" >
            
                <span>
            
                    
                    Redis框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" >
            
                <span>
            
                    
                    FastDFS
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" >
            
                <span>
            
                    
                    定时任务
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" >
            
                <span>
            
                    
                    RabbitMQ
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" >
            
                <span>
            
                    
                    RocketMQ
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" >
            
                <span>
            
                    
                    JMS
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.7" >
            
                <span>
            
                    
                    MyCat
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.8" >
            
                <span>
            
                    
                    RabbitMQ
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.9" >
            
                <span>
            
                    
                    Kafka
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.10" >
            
                <span>
            
                    
                    Sharding-JDBC
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.11" >
            
                <span>
            
                    
                    Neo4j
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.12" >
            
                <span>
            
                    
                    MongoDB
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.13" >
            
                <span>
            
                    
                    ELK
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.14" >
            
                <span>
            
                    
                    Restful风格编程
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.15" >
            
                <span>
            
                    
                    Swagger文档
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.16" >
            
                <span>
            
                    
                    JMeter
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    JavaWeb微服务分布框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" >
            
                <span>
            
                    
                    Spring Boot框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" >
            
                <span>
            
                    
                    Spring Cloud框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" >
            
                <span>
            
                    
                    Zookeeper
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" >
            
                <span>
            
                    
                    Dubbo框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" >
            
                <span>
            
                    
                    Eureka
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" >
            
                <span>
            
                    
                    Consul
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" >
            
                <span>
            
                    
                    Hystrix
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" >
            
                <span>
            
                    
                    Zuul
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" >
            
                <span>
            
                    
                    Gateway
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.10" >
            
                <span>
            
                    
                    Skywalking
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.11" >
            
                <span>
            
                    
                    Pinpoint
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" >
            
                <span>
            
                    
                    JavaWeb部署
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" >
            
                <span>
            
                    
                    Docker
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" >
            
                <span>
            
                    
                    项目构建
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="java4.html">
            
                <a href="java4.html#1">
            
                    
                    JavaWeb实战项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="java4.html">
            
                <a href="java4.html#2">
            
                    
                    微人事项目实战
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="java16.html">
            
                <a href="java16.html">
            
                    
                    新蜂商城
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="moutn10.html">
            
                <a href="moutn10.html">
            
                    
                    2020年10月账本
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="day23.html">
            
                <a href="day23.html">
            
                    
                    10月23日
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="day29.html">
            
                <a href="day29.html">
            
                    
                    10月29日
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="moutn11.md">
            
                <span>
            
                    
                    2020年11月账本
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >更强大和方便的功能--注解</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
<div id="vip-container">
    <p>&#x66F4;&#x5F3A;&#x5927;&#x548C;&#x65B9;&#x4FBF;&#x7684;&#x529F;&#x80FD;&#x2014;&#x2014;&#x6CE8;&#x89E3;JDK 5.0&#x4EE5;&#x540E;&#x589E;&#x52A0;&#x4E86;&#x6CE8;&#x89E3;&#xFF0C;&#x6CE8;&#x89E3;&#x4E0D;&#x4F46;&#x589E;&#x5F3A;&#x4E86;&#x7A0B;&#x5E8F;&#x7F16;&#x5199;&#x7684;&#x65B9;&#x4FBF;&#x6027;&#xFF0C;&#x800C;&#x4E14;&#x7A0B;&#x5E8F;&#x5458;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x53CD;&#x5C04;&#x673A;&#x5236;&#xFF0C;&#x5B8C;&#x6210;&#x5BF9;&#x7F16;&#x7A0B;&#x4FE1;&#x606F;&#x7684;&#x8BBF;&#x95EE;&#x3002;</p>
<p>&#x672C;&#x7AE0;&#x4ECB;&#x7ECD;&#x6CE8;&#x89E3;&#x7684;&#x7528;&#x6CD5;&#x3001;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x3001;&#x901A;&#x8FC7;&#x53CD;&#x5C04;&#x8BBF;&#x95EE;&#x6CE8;&#x89E3;&#x53CA;&#x901A;&#x8FC7;&#x6CE8;&#x89E3;&#x751F;&#x6210;&#x6CE8;&#x91CA;&#x7B49;&#x5185;&#x5BB9;&#x3002;</p>
<p>&#x672C;&#x7AE0;&#x8981;&#x70B9;&#xFF08;&#x5DF2;&#x638C;&#x63E1;&#x7684;&#x5728;&#x65B9;&#x6846;&#x4E2D;&#x6253;&#x94A9;&#xFF09;&#x6CE8;&#x89E3;&#x6982;&#x8FF0;&#x5E38;&#x7528;&#x5185;&#x7F6E;&#x6CE8;&#x89E3;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x901A;&#x8FC7;&#x53CD;&#x5C04;&#x8BBF;&#x95EE;&#x6CE8;&#x89E3;11.1 &#x6CE8;&#x89E3;&#x6982;&#x8FF0;&#x6CE8;&#x89E3;&#xFF08;Annotation&#xFF09;&#xFF0C;&#x6216;&#x53EB;&#x6CE8;&#x91CA;&#xFF0C;&#x662F;JDK 1.5&#x4EE5;&#x540E;&#x5F15;&#x5165;&#x7684;&#x6CE8;&#x91CA;&#x7684;&#x8BED;&#x6CD5;&#xFF0C;&#x4F46;&#x662F;&#x5B83;&#x5374;&#x533A;&#x522B;&#x4E8E;&#x666E;&#x901A;&#x7684;&#x6CE8;&#x91CA;&#xFF0C;&#x666E;&#x901A;&#x7684;&#x4EE3;&#x7801;&#x6CE8;&#x91CA;&#x901A;&#x8FC7;&#x201C;//&#x201D;&#x6216;&#x201C;/<em>&#x2026;.</em>/&#x201D;&#x5373;&#x53EF;&#x5B8C;&#x6210;&#x6CE8;&#x91CA;&#x3002;</p>
<p>&#x6CE8;&#x89E3;&#x9664;&#x4E86;&#x5177;&#x5907;&#x7B80;&#x5355;&#x7684;&#x6CE8;&#x91CA;&#x529F;&#x80FD;&#x5916;&#xFF0C;&#x66F4;&#x591A;&#x7684;&#x53EF;&#x4EE5;&#x5B8C;&#x6210;&#x201C;&#x914D;&#x7F6E;&#x201D;&#x5F0F;&#x7684;&#x7F16;&#x7A0B;&#x3002;</p>
<p>&#x901A;&#x8FC7;&#x6CE8;&#x89E3;&#x53EF;&#x4EE5;&#x914D;&#x7F6E;&#x4E00;&#x4E9B;&#x7F16;&#x7A0B;&#x7684;&#x5143;&#x6570;&#x636E;&#xFF0C;&#x6BD4;&#x5982;&#x5BF9;&#x7C7B;&#x3001;&#x65B9;&#x6CD5;&#x3001;&#x53D8;&#x91CF;&#x3001;&#x5C5E;&#x6027;&#x7B49;&#x7684;&#x58F0;&#x660E;&#xFF0C;&#x901A;&#x8FC7;&#x6CE8;&#x89E3;&#x7684;&#x58F0;&#x660E;&#x53EF;&#x4EE5;&#x5728;&#x7F16;&#x8BD1;&#x65F6;&#x3001;&#x7C7B;&#x52A0;&#x8F7D;&#x65F6;&#x548C;&#x8FD0;&#x884C;&#x65F6;&#x5B9E;&#x73B0;&#x5BF9;&#x8FD9;&#x4E9B;&#x58F0;&#x660E;&#x7684;&#x8BBF;&#x95EE;&#xFF0C;&#x4ECE;&#x800C;&#x5B8C;&#x6210;&#x66F4;&#x52A0;&#x7075;&#x6D3B;&#x7684;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x3002;</p>
<p>&#x5B9E;&#x9645;&#x4E0A;&#xFF0C;&#x6CE8;&#x89E3;&#x662F;&#x4E00;&#x79CD;&#x63A5;&#x53E3;&#x5B9A;&#x4E49;&#xFF0C;&#x901A;&#x8FC7;&#x8BE5;&#x63A5;&#x53E3;&#x5B9A;&#x4E49;&#xFF0C;&#x518D;&#x5229;&#x7528;Java&#x7684;&#x53CD;&#x5C04;&#x673A;&#x5236;&#x6765;&#x5B8C;&#x6210;&#x5176;&#x4FE1;&#x606F;&#x7684;&#x8BBF;&#x95EE;&#x3002;</p>
<p>&#x4E00;&#x822C;&#x6765;&#x8BB2;&#xFF0C;&#x901A;&#x8FC7;JDK&#x5185;&#x7F6E;&#x7684;Annotation&#x548C;&#x81EA;&#x5B9A;&#x4E49;&#x7684;Annotation&#x4E3B;&#x8981;&#x53EF;&#x4EE5;&#x5B8C;&#x6210;&#x4EE5;&#x4E0B;&#x51E0;&#x4E2A;&#x529F;&#x80FD;&#x3002;</p>
<p>&#x63A7;&#x5236;JavaDoc&#x6587;&#x6863;&#x7684;&#x751F;&#x6210;&#x3002;</p>
<p>&#x8DDF;&#x8E2A;&#x4EE3;&#x7801;&#x7684;&#x4F9D;&#x8D56;&#x6027;&#xFF0C;&#x5B9E;&#x73B0;&#x914D;&#x7F6E;&#x5F0F;&#x7F16;&#x7A0B;&#x3002;</p>
<p>&#x8FD0;&#x884C;&#x65F6;&#x8BBF;&#x95EE;&#x7F16;&#x7A0B;&#x5143;&#x6570;&#x636E;&#x3002;</p>
<p>&#x7F16;&#x8BD1;&#x65F6;&#x5B9E;&#x73B0;&#x683C;&#x5F0F;&#x68C0;&#x67E5;&#x3002;</p>
<p>&#x6CE8;&#x89E3;&#x88AB;&#x5E7F;&#x6CDB;&#x5E94;&#x7528;&#x5230;&#x5404;&#x79CD;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x4E2D;&#xFF0C;&#x76EE;&#x524D;&#x6D41;&#x884C;&#x7684;&#x5F00;&#x53D1;&#x6846;&#x67B6;SSH&#xFF08;Struts&#x3001;Spring&#x3001;Hibernate&#xFF09;&#x4E2D;&#x5C31;&#x5927;&#x91CF;&#x5730;&#x4F7F;&#x7528;&#x4E86;&#x6CE8;&#x89E3;&#xFF0C;&#x6BD4;&#x5982;&#x5728;Spring&#x7684;&#x5F00;&#x53D1;&#x914D;&#x7F6E;&#x4E2D;&#xFF0C;&#x65E2;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7F16;&#x5199;XML&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x6765;&#x5B9E;&#x73B0;&#x5404;&#x79CD;Bean&#x7684;&#x7BA1;&#x7406;&#x548C;&#x6CE8;&#x5165;&#xFF0C;&#x540C;&#x65F6;&#x53EF;&#x4EE5;&#x5229;&#x7528;&#x6CE8;&#x89E3;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x76F4;&#x63A5;&#x5728;&#x7F16;&#x7A0B;&#x65F6;&#x5B9E;&#x73B0;Bean&#x7684;&#x58F0;&#x660E;&#x548C;&#x6CE8;&#x5165;&#xFF0C;&#x8FD9;&#x4E9B;&#x5B9E;&#x9645;&#x4E0A;&#x5C31;&#x662F;&#x5229;&#x7528;&#x6CE8;&#x89E3;&#x548C;&#x53CD;&#x5C04;&#x673A;&#x5236;&#xFF0C;&#x8BBF;&#x95EE;&#x4E86;&#x7F16;&#x7A0B;&#x5143;&#x6570;&#x636E;&#x6765;&#x5B9E;&#x73B0;&#x7684;&#x3002;</p>
<p>&#x672C;&#x7AE0;&#x63A5;&#x4E0B;&#x6765;&#x8BB2;&#x89E3;&#x4E00;&#x4E0B;JDK&#x5185;&#x7F6E;&#x7684;&#x4E00;&#x4E9B;&#x5E38;&#x7528;&#x6CE8;&#x89E3;&#x7528;&#x6CD5;&#xFF0C;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x65B9;&#x6CD5;&#x548C;&#x6CE8;&#x89E3;&#x8F83;&#x4E3A;&#x590D;&#x6742;&#x7684;&#x4E00;&#x4E9B;&#x7528;&#x6CD5;&#x3002;</p>
<p>11.2 &#x5E38;&#x7528;&#x5185;&#x7F6E;&#x6CE8;&#x89E3;&#x5728;JDK 5.0&#x4E2D;&#xFF0C;&#x5185;&#x7F6E;&#x4E86;&#x4E00;&#x4E9B;&#x6CE8;&#x89E3;&#xFF0C;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x6CE8;&#x89E3;&#x65B9;&#x4FBF;&#x6211;&#x4EEC;&#x5BF9;&#x7A0B;&#x5E8F;&#x7684;&#x63A7;&#x5236;&#x548C;&#x7F16;&#x5199;&#xFF0C;&#x65B9;&#x4FBF;JavaDoc&#x7684;&#x8F93;&#x51FA;&#x63A7;&#x5236;&#x3002;</p>
<p>&#x5185;&#x7F6E;&#x6CE8;&#x89E3;&#x5206;&#x4E3A;&#x4E24;&#x7C7B;&#xFF0C;&#x4E00;&#x7C7B;&#x662F;&#x5143;&#x6CE8;&#x89E3;&#xFF0C;&#x53E6;&#x4E00;&#x7C7B;&#x662F;&#x666E;&#x901A;&#x6CE8;&#x89E3;&#x3002;</p>
<p>&#x6240;&#x8C13;&#x7684;&#x5143;&#x6CE8;&#x89E3;&#x5C31;&#x662F;&#x5BF9;&#x6CE8;&#x89E3;&#x7684;&#x6CE8;&#x89E3;&#xFF0C;&#x8FD9;&#x4E2A;&#x6211;&#x4EEC;&#x5728;&#x672C;&#x7AE0;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x5C0F;&#x8282;&#x8BB2;&#x89E3;&#xFF0C;&#x4E0B;&#x9762;&#x4E3B;&#x8981;&#x4ECB;&#x7ECD;&#x666E;&#x901A;&#x6CE8;&#x89E3;&#x3002;</p>
<p>&#x5E38;&#x89C1;&#x7684;&#x666E;&#x901A;&#x6CE8;&#x89E3;&#x6709;@Override&#x3001;@Deprecate&#x3001;@SuppressWarnings&#x7B49;&#x3002;</p>
<p>&#x6CE8;&#x89E3;&#x7684;&#x7279;&#x6B8A;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#x5C31;&#x662F;&#x5FC5;&#x987B;&#x5728;&#x5173;&#x952E;&#x5B57;&#x524D;&#x9762;&#x52A0;&#x4E0A;&#x201C;@&#x201D;&#xFF0C;&#x65E0;&#x8BBA;&#x662F;&#x5185;&#x7F6E;&#x6CE8;&#x89E3;&#x8FD8;&#x662F;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x5747;&#x662F;&#x8FD9;&#x6837;&#x3002;</p>
<p>@Override&#x6CE8;&#x89E3;&#x7528;&#x6765;&#x544A;&#x8BC9;&#x7F16;&#x8BD1;&#x5668;&#xFF0C;@Override&#x58F0;&#x660E;&#x7684;&#x65B9;&#x6CD5;&#x662F;&#x8986;&#x76D6;&#x8D85;&#x7C7B;&#x65B9;&#x6CD5;&#x7684;&#x3002;</p>
<p>@Deprecate&#x6CE8;&#x89E3;&#x544A;&#x8BC9;&#x7F16;&#x8BD1;&#x5668;&#x672C;&#x65B9;&#x6CD5;&#x4E0D;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;&#x3002;</p>
<p>@SuppressWarnings&#x6CE8;&#x89E3;&#x7528;&#x6765;&#x6291;&#x5236;&#x8B66;&#x544A;&#x4FE1;&#x606F;&#x7684;&#x663E;&#x793A;&#x3002;</p>
<p>@Documented&#x6CE8;&#x89E3;&#x5219;&#x7528;&#x6765;&#x5C06;&#x81EA;&#x5B9A;&#x4E49;&#x7684;&#x6CE8;&#x89E3;&#x8BBE;&#x7F6E;&#x6210;&#x6587;&#x6863;&#x8BF4;&#x660E;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x4E00;&#x4E00;&#x4E3E;&#x4F8B;&#x8BF4;&#x660E;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-1 &#x901A;&#x8FC7;@Override&#x8986;&#x76D6;&#x8D85;&#x7C7B;&#x65B9;&#x6CD5;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_1 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">test</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;ok&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> subCh11_1 <span class="token keyword">extends</span> ch11_1<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@Override</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Test</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;<span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;ok&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000; <span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;09&#x884C;&#x7684;&#x672C;&#x610F;&#x662F;&#x8981;&#x8986;&#x76D6;&#x8D85;&#x7C7B;ch11_1&#x7684;&#x65B9;&#x6CD5;test&#xFF0C;&#x4F46;&#x662F;&#x540D;&#x5B57;Test&#x7684;&#x9996;&#x5B57;&#x6BCD;&#x5199;&#x6210;&#x4E86;&#x5927;&#x5199;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x65E0;&#x6CD5;&#x5B9E;&#x73B0;&#x5BF9;&#x8D85;&#x7C7B;&#x65B9;&#x6CD5;&#x7684;&#x8986;&#x76D6;&#xFF0C;&#x56E0;&#x4E3A;&#x8986;&#x76D6;&#x5FC5;&#x987B;&#x65B9;&#x6CD5;&#x540D;&#x76F8;&#x540C;&#xFF0C;&#x8FD4;&#x56DE;&#x503C;&#x76F8;&#x540C;&#xFF0C;&#x53C2;&#x6570;&#x4E5F;&#x76F8;&#x540C;&#x3002;</p>
<p>&#x8FD9;&#x65F6;&#x5019;&#x53EF;&#x4EE5;&#x52A0;&#x4E0A;&#x7B2C;08&#x884C;&#x7684;@Override&#x6CE8;&#x89E3;&#xFF0C;&#x8BE5;&#x6CE8;&#x89E3;&#x6307;&#x660E;Test&#x65B9;&#x6CD5;&#x662F;&#x5BF9;&#x8D85;&#x7C7B;&#x65B9;&#x6CD5;&#x7684;&#x8986;&#x76D6;&#xFF0C;&#x56E0;&#x6B64;&#x7F16;&#x8BD1;&#x5668;&#x4F1A;&#x68C0;&#x67E5;&#x662F;&#x5426;&#x6709;&#x8986;&#x76D6;&#x9519;&#x8BEF;&#x3002;</p>
<p>&#x672C;&#x4F8B;&#x7F16;&#x8BD1;&#x901A;&#x4E0D;&#x8FC7;&#xFF0C;&#x53EA;&#x6709;&#x628A;Test&#x7684;&#x9996;&#x5B57;&#x6BCD;&#x6539;&#x6210;&#x5C0F;&#x5199;&#x540E;&#xFF0C;&#x65B9;&#x53EF;&#x8FD0;&#x884C;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-2 &#x901A;&#x8FC7;@SuppressWarnings&#x5173;&#x95ED;&#x8B66;&#x544A;&#x4FE1;&#x606F;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_2 <span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span> args<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000; <span class="token annotation punctuation">@SuppressWarnings</span><span class="token punctuation">(</span><span class="token string">&quot;unused&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000;&#x3000; <span class="token keyword">int</span> a<span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; <span class="token class-name">String</span> bString<span class="token operator">=</span><span class="token string">&quot;ok&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;@SuppressWarnings description&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000; <span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;05&#x884C;&#x548C;&#x7B2C;06&#x884C;&#x5206;&#x522B;&#x5B9A;&#x4E49;&#x4E86;2&#x4E2A;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x7F16;&#x8BD1;&#x65F6;&#xFF0C;&#x7B2C;06&#x884C;&#x4F1A;&#x62A5;&#x4E00;&#x4E2A;&#x8B66;&#x544A;&#x9519;&#x8BEF;&#x201C;The value of the local variable bString is not used&#x201D;&#xFF0C;&#x610F;&#x601D;&#x662F;&#x8BF4;&#x672C;&#x5730;&#x53D8;&#x91CF;bString&#x867D;&#x7136;&#x5B9A;&#x4E49;&#x4E86;&#x5374;&#x6CA1;&#x6709;&#x88AB;&#x4F7F;&#x7528;&#xFF0C;&#x8FD9;&#x4E2A;&#x8B66;&#x544A;&#x9519;&#x8BEF;&#x662F;&#x4E0D;&#x5F71;&#x54CD;&#x8FD0;&#x884C;&#x7684;&#xFF0C;&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x51FA;&#x73B0;&#x8FD9;&#x79CD;&#x9519;&#x8BEF;&#x63D0;&#x793A;&#xFF0C;&#x53EF;&#x4EE5;&#x50CF;&#x7B2C;04&#x884C;&#x4E00;&#x6837;&#xFF0C;&#x52A0;&#x5165;@SuppressWarnings(&quot;unused&quot;)&#x6CE8;&#x89E3;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x907F;&#x514D;&#x8B66;&#x544A;&#x9519;&#x8BEF;&#x7684;&#x63D0;&#x793A;&#x3002;</p>
<p>@SuppressWarnings&#x53EF;&#x4EE5;&#x6807;&#x6CE8;&#x5728;&#x7C7B;&#x3001;&#x5B57;&#x6BB5;&#x3001;&#x65B9;&#x6CD5;&#x3001;&#x53C2;&#x6570;&#x3001;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#xFF0C;&#x4EE5;&#x53CA;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x4E0A;&#xFF0C;&#x9664;&#x4E86;unused&#x5916;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x7528;unchecked&#x3001;serial&#x3001;deprecation&#x7B49;&#x5FFD;&#x7565;&#x5BF9;&#x5E94;&#x7684;&#x8B66;&#x544A;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-3 &#x901A;&#x8FC7;@Deprecate&#x544A;&#x77E5;&#x7F16;&#x8BD1;&#x5668;&#x88AB;&#x6807;&#x6CE8;&#x7684;&#x5143;&#x7D20;&#x662F;&#x4E0D;&#x5E0C;&#x671B;&#x88AB;&#x4F7F;&#x7528;&#x7684;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_3 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>    
&#x3000;    &#x3000;&#x3000; ch11_3_1<span class="token punctuation">.</span><span class="token function">test1</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; ch11_3_1<span class="token punctuation">.</span><span class="token function">test2</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> ch11_3_1<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@Deprecated</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">test1</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;test1 method is deprecated&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">test2</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;test1 method is pray&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>    
  <span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;09&#x884C;&#x52A0;&#x5165;@Deprecated&#x6CE8;&#x89E3;&#x540E;&#xFF0C;&#x7B2C;04&#x884C;&#x8C03;&#x7528;&#x65F6;&#xFF0C;&#x7CFB;&#x7EDF;&#x4F1A;&#x5F39;&#x51FA;&#x8B66;&#x544A;&#x4FE1;&#x606F;&#xFF0C;&#x544A;&#x77E5;test1&#x65B9;&#x6CD5;&#x5DF2;&#x7ECF;&#x4E0D;&#x518D;&#x4F7F;&#x7528;&#x4E86;&#x3002;</p>
<p>JDK&#x4E3A;&#x4E86;&#x517C;&#x5BB9;&#x8001;&#x7248;&#x672C;&#x7684;API&#xFF0C;&#x5F88;&#x591A;&#x65B9;&#x6CD5;&#x90FD;&#x52A0;&#x5165;&#x4E86;@Deprecated&#xFF0C;&#x4F7F;&#x7528;&#x8FD9;&#x4E9B;&#x8001;&#x7684;&#x65B9;&#x6CD5;&#x65F6;&#x90FD;&#x4F1A;&#x63D0;&#x793A;&#x8B66;&#x544A;&#x4FE1;&#x606F;&#xFF0C;&#x4F46;&#x4E0D;&#x5F71;&#x54CD;&#x8FD0;&#x884C;&#x3002;</p>
<p>11.3 &#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x5141;&#x8BB8;&#x5F00;&#x53D1;&#x8005;&#x5F00;&#x53D1;&#x81EA;&#x5DF1;&#x7684;&#x6CE8;&#x89E3;&#xFF0C;&#x4ECE;&#x800C;&#x5B9E;&#x73B0;&#x66F4;&#x52A0;&#x7075;&#x6D3B;&#x548C;&#x590D;&#x6742;&#x7684;&#x7F16;&#x7A0B;&#x601D;&#x60F3;&#x3002;</p>
<p>&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x7684;&#x8BED;&#x6CD5;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;</p>
<p>[public] @interface &#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x7684;&#x540D;&#x79F0;{    [&#x6570;&#x636E;&#x7C7B;&#x578B; &#x53D8;&#x91CF;&#x540D;&#x79F0;();]}&#x6CE8;&#x610F;@interface&#x7684;&#x5199;&#x6CD5;&#xFF0C;&#x5FC5;&#x987B;&#x52A0;&#x4E0A;&#x201C;@&#x201D;&#xFF0C;&#x53E6;&#x5916;&#x5C31;&#x662F;&#x6CE8;&#x89E3;&#x7684;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#xFF0C;&#x6BCF;&#x4E2A;&#x53D8;&#x91CF;&#x540E;&#x9762;&#x52A0;&#x4E0A;&#x201C;()&#x201D;&#xFF0C;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x65F6;&#xFF0C;&#x4E00;&#x822C;&#x8FD8;&#x8981;&#x6307;&#x660E;&#x6CE8;&#x89E3;&#x7684;&#x4F5C;&#x7528;&#x8303;&#x56F4;&#xFF0C;&#x901A;&#x8FC7;@Retention&#x6CE8;&#x89E3;&#x6765;&#x6307;&#x660E;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;@Retention &#x6CE8;&#x89E3;&#x65F6;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x7684;&#x6CE8;&#x89E3;&#xFF0C;&#x6211;&#x4EEC;&#x79F0;&#x4E3A;&#x5143;&#x6CE8;&#x89E3;&#xFF0C;&#x5E38;&#x89C1;&#x7684;&#x5143;&#x6CE8;&#x89E3;&#x6709;@Target&#x3001;@Retention&#x3001;@Documented&#x3001;@Inherited&#x3002;</p>
<p>&#x56E0;&#x6B64;&#x5728;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x65F6;&#xFF0C;&#x5F80;&#x5F80;&#x914D;&#x5408;&#x5143;&#x6CE8;&#x89E3;&#x6765;&#x4E30;&#x5BCC;&#x548C;&#x5B8C;&#x5584;&#x6CE8;&#x89E3;&#x7684;&#x5B9A;&#x4E49;&#x3002;</p>
<p>@Retention&#x8868;&#x793A;&#x5728;&#x4EC0;&#x4E48;&#x7EA7;&#x522B;&#x4FDD;&#x5B58;&#x8BE5;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x53EF;&#x9009;&#x7684;&#x53C2;&#x6570;&#x503C;&#x5728;&#x679A;&#x4E3E;&#x7C7B;&#x578B; RetentionPolicy&#x4E2D;&#xFF0C;&#x8BE5;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#x7684;&#x503C;&#x5982;&#x4E0B;&#x8868;&#x6240;&#x793A;&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x679A;&#x4E3E;&#x503C;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>RetentionPolicy.SOURCE</td>
<td>&#x6CE8;&#x89E3;&#x5C06;&#x88AB;&#x7F16;&#x8BD1;&#x5668;&#x4E22;&#x5F03;</td>
</tr>
<tr>
<td>RetentionPolicy.CLASS</td>
<td>&#x6CE8;&#x89E3;&#x5728;class&#x6587;&#x4EF6;&#x4E2D;&#x53EF;&#x7528;&#xFF0C;&#x4F46;&#x4F1A;&#x88AB;JVM&#x4E22;&#x5F03;</td>
</tr>
<tr>
<td>RetentionPolicy.RUNTIMEJVM</td>
<td>&#x5C06;&#x5728;&#x7F16;&#x8BD1;&#x3001;&#x52A0;&#x8F7D;&#x3001;&#x8FD0;&#x884C;&#x671F;&#x5747;&#x4FDD;&#x7559;&#x6CE8;&#x89E3;&#xFF0C;&#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x901A;&#x53CD;&#x5C04;&#x673A;&#x5236;&#x8BFB;&#x53D6;&#x6CE8;&#x89E3;&#x7684;&#x4FE1;&#x606F;&#xFF5C;</td>
</tr>
</tbody>
</table>
<p>&#x82E5;&#x6CA1;&#x6709;&#x6307;&#x5B9A;@Retention&#xFF0C;&#x9ED8;&#x8BA4;&#x7684;&#x7F16;&#x8BD1;&#x5668;&#x8BA4;&#x4E3A;@Retention &#x6307;&#x5B9A;&#x7684;&#x662F;RetentionPolicy.CLASS&#x3002;</p>
<p>@Target &#x8868;&#x793A;&#x8BE5;&#x6CE8;&#x89E3;&#x7528;&#x4E8E;&#x4EC0;&#x4E48;&#x5730;&#x65B9;&#xFF0C;&#x53EF;&#x80FD;&#x7684;&#x503C;&#x5728;&#x679A;&#x4E3E;&#x7C7B; ElemenetType&#x4E2D;&#xFF0C;&#x5982;&#x4E0B;&#x8868;&#x6240;&#x793A;&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x679A;&#x4E3E;&#x503C;</th>
<th>&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td>ElemenetType.CONSTRUCTOR</td>
<td>&#x6784;&#x9020;&#x5668;&#x58F0;&#x660E;</td>
</tr>
<tr>
<td>ElemenetType.FIELD</td>
<td>&#x57DF;&#x58F0;&#x660E;&#xFF08;&#x5305;&#x62EC; enum &#x5B9E;&#x4F8B;&#xFF09;</td>
</tr>
<tr>
<td>ElemenetType.LOCAL_VARIABLE</td>
<td>&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x58F0;&#x660E;</td>
</tr>
<tr>
<td>ElemenetType.ANNOTATION_TYPE</td>
<td>&#x4F5C;&#x7528;&#x4E8E;&#x6CE8;&#x89E3;&#x91CF;&#x58F0;&#x660E;</td>
</tr>
<tr>
<td>ElemenetType.METHOD</td>
<td>&#x65B9;&#x6CD5;&#x58F0;&#x660E;</td>
</tr>
<tr>
<td>ElemenetType.PACKAGE</td>
<td>&#x5305;&#x58F0;&#x660E;</td>
</tr>
<tr>
<td>ElemenetType.PARAMETER</td>
<td>&#x53C2;&#x6570;&#x58F0;&#x660E;</td>
</tr>
<tr>
<td>ElemenetType.TYPE</td>
<td>&#x7C7B;&#xFF0C;&#x63A5;&#x53E3;&#xFF08;&#x5305;&#x62EC;&#x6CE8;&#x89E3;&#x7C7B;&#x578B;&#xFF09;&#x6216;enum&#x58F0;&#x660E;</td>
</tr>
</tbody>
</table>
<p>@Documented &#x5C06;&#x6B64;&#x6CE8;&#x89E3;&#x5305;&#x542B;&#x5728; javadoc &#x4E2D; &#xFF0C;&#x5B83;&#x4EE3;&#x8868;&#x7740;&#x6B64;&#x6CE8;&#x89E3;&#x4F1A;&#x88AB;javadoc&#x5DE5;&#x5177;&#x63D0;&#x53D6;&#x6210;&#x6587;&#x6863;&#x3002;</p>
<p>&#x5728;doc&#x6587;&#x6863;&#x4E2D;&#x7684;&#x5185;&#x5BB9;&#x4F1A;&#x56E0;&#x4E3A;&#x6B64;&#x6CE8;&#x89E3;&#x7684;&#x4FE1;&#x606F;&#x5185;&#x5BB9;&#x4E0D;&#x540C;&#x800C;&#x4E0D;&#x540C;&#x3002;</p>
<p> @Inherited &#x5141;&#x8BB8;&#x5B50;&#x7C7B;&#x7EE7;&#x627F;&#x7236;&#x7C7B;&#x4E2D;&#x7684;&#x6CE8;&#x89E3;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-4 &#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;TestAnnoaction0</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation0<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodname&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_4 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@testAnnoation0</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;&#x7535;&#x6C60;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">testAnnoation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>        
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;02~05&#x884C;&#x81EA;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x6CE8;&#x89E3;testAnnoation0&#x3002;</p>
<p>&#x7B2C;03&#x884C;&#x6307;&#x5B9A;&#x4E86;&#x6CE8;&#x89E3;&#x7684;&#x5C5E;&#x6027;name&#xFF0C;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x201C;methodname&#x201D;&#x3002;</p>
<p>&#x7B2C;04&#x884C;&#x6307;&#x5B9A;&#x4E86;&#x6CE8;&#x89E3;&#x7684;&#x5C5E;&#x6027;unit&#xFF0C;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x201C;unit&#x201D;&#x3002;</p>
<p>&#x7B2C;09&#x884C;&#x4F7F;&#x7528;&#x4E86;&#x8BE5;&#x6CE8;&#x89E3;&#xFF0C;&#x5E76;&#x5C06;&#x6CE8;&#x89E3;&#x7684;name&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A;&#x201C;&#x7535;&#x6C60;SOC&#x201D;&#xFF0C;unit&#x7684;&#x503C;&#x4E3A; &#x201C;%&#x201D;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-5 &#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;TestAnnoation1&#xFF0C;&#x6307;&#x5B9A;&#x6CE8;&#x89E3;&#x7684;&#x4F5C;&#x7528;&#x5BF9;&#x8C61;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">ElementType</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Target</span><span class="token punctuation">;</span>
&#x3000;<span class="token annotation punctuation">@Target</span><span class="token punctuation">(</span><span class="token class-name">ElementType</span><span class="token punctuation">.</span>METHOD<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation1<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodname&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_5 <span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@testAnnoation1</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;&#x7535;&#x6C60;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">testAnnoation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>        
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;05&#x884C;&#x6307;&#x5B9A;&#x4E86;&#x6CE8;&#x89E3;testAnnoation&#x7528;&#x4E8E;&#x65B9;&#x6CD5;&#x7684;&#x58F0;&#x660E;&#x3002;</p>
<p>&#x5982;&#x679C;&#x7528;&#x5728;&#x975E;&#x65B9;&#x6CD5;&#x7684;&#x5143;&#x7D20;&#x4E0A;&#xFF0C;&#x6BD4;&#x5982;&#x6210;&#x5458;&#x5C5E;&#x6027;&#xFF0C;&#x90A3;&#x4E48;&#x7F16;&#x8BD1;&#x662F;&#x901A;&#x4E0D;&#x8FC7;&#x7684;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-6 &#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;TestAnnoation2&#xFF0C;&#x5E76;&#x6307;&#x5B9A;&#x4EC0;&#x4E48;&#x7EA7;&#x522B;&#x4FDD;&#x5B58;&#x8BE5;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">ElementType</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Retention</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Target</span><span class="token punctuation">;</span>
&#x3000;<span class="token annotation punctuation">@Retention</span><span class="token punctuation">(</span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">.</span>RUNTIME<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@Target</span><span class="token punctuation">(</span><span class="token class-name">ElementType</span><span class="token punctuation">.</span>METHOD<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation2<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodname&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_6 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@testAnnoation2</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;&#x7535;&#x6C60;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">testAnnoation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>        
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;06&#x884C;&#x6307;&#x5B9A;&#x4E86;&#x6CE8;&#x89E3;testAnnoation&#x7684;&#x4FDD;&#x7559;&#x7EA7;&#x522B;&#x4E3A;RetentionPolicy.RUNTIME&#xFF0C;&#x8FD9;&#x5C31;&#x610F;&#x5473;&#x7740;&#x8BE5;&#x6CE8;&#x89E3;&#x5728;&#x7F16;&#x8BD1;&#x3001;&#x52A0;&#x8F7D;&#x3001;&#x8FD0;&#x884C;&#x671F;&#x5747;&#x4FDD;&#x7559;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-7 &#x901A;&#x8FC7;@Document&#x63A7;&#x5236;JavaDoc&#x7684;&#x8F93;&#x51FA;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Documented</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">ElementType</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Retention</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Target</span><span class="token punctuation">;</span>
&#x3000;<span class="token annotation punctuation">@Documented</span>
&#x3000;<span class="token annotation punctuation">@Retention</span><span class="token punctuation">(</span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">.</span>RUNTIME<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@Target</span><span class="token punctuation">(</span><span class="token class-name">ElementType</span><span class="token punctuation">.</span>METHOD<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodnam&quot;</span>&#x201D;<span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_7 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@testAnnoation</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;&#x7535;&#x6C60;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">testAnnoation</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>        
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x4ECE;&#x7B2C;07~13&#x884C;&#x81EA;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x6CE8;&#x89E3;testAnnoation&#xFF08;&#x5173;&#x4E8E;&#x5982;&#x4F55;&#x81EA;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x5C06;&#x5728;&#x4E0B;&#x4E00;&#x5C0F;&#x8282;&#x8BB2;&#x89E3;&#xFF09;&#xFF0C;&#x5728;&#x7B2C;18&#x884C;&#x4F7F;&#x7528;&#x4E86;&#x8BE5;&#x6CE8;&#x89E3;&#xFF0C;&#x6CE8;&#x610F;&#x5982;&#x679C;&#x5728;&#x7B2C;07&#x884C;&#x4E0D;&#x5199;@Documented&#x6CE8;&#x89E3;&#xFF0C;&#x90A3;&#x4E48;&#x751F;&#x6210;JavaDoc&#x6587;&#x6863;&#x65F6;&#xFF0C;&#x5173;&#x4E8E;&#x7C7B;ch11_4 &#x4E2D;testAnnoation&#x65B9;&#x6CD5;&#x7684;&#x8BF4;&#x660E;&#x5982;&#x4E0B;&#x3002;</p>
<p>&#x7EC6;&#x5FC3;&#x7684;&#x8BFB;&#x8005;&#x4F1A;&#x53D1;&#x73B0;&#xFF0C;&#x6CA1;&#x6709;&#x5173;&#x4E8E;&#x6CE8;&#x89E3;@testAnnoation&#x7684;&#x4EFB;&#x4F55;&#x4FE1;&#x606F;&#xFF0C;&#x4F46;&#x662F;&#x5F53;&#x6211;&#x4EEC;&#x52A0;&#x4E0A;&#x7B2C;07&#x884C;&#x7684;@Documented&#x6CE8;&#x89E3;&#x540E;&#xFF0C;&#x518D;&#x751F;&#x6210;&#x7684;JavaDoc&#x6587;&#x6863;&#x5982;&#x4E0B;&#x3002;</p>
<p>@testAnnoation&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x663E;&#x793A;&#x51FA;&#x6765;&#x4E86;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;@Documented&#x5728;&#x5B9A;&#x4E49;&#x6CE8;&#x89E3;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x63A7;&#x5236;&#x4E86;&#x662F;&#x5426;&#x5728;&#x751F;&#x6210;&#x6587;&#x6863;&#x7684;&#x65F6;&#x5019;&#x751F;&#x6210;&#x6709;&#x5173;&#x6CE8;&#x89E3;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
<p>11.4 &#x901A;&#x8FC7;&#x53CD;&#x5C04;&#x8BBF;&#x95EE;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x5229;&#x7528;Java&#x7684;&#x53CD;&#x5C04;&#x673A;&#x5236;&#xFF0C;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE;&#x6CE8;&#x89E3;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x6BD4;&#x5982;&#x5728;&#x8C03;&#x7528;&#x67D0;&#x4E2A;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x77E5;&#x9053;&#x8BE5;&#x65B9;&#x6CD5;&#x7684;&#x4E00;&#x4E9B;&#x57FA;&#x672C;&#x4FE1;&#x606F;&#xFF0C;&#x800C;&#x8FD9;&#x4E9B;&#x4FE1;&#x606F;&#x53C8;&#x9700;&#x8981;&#x52A8;&#x6001;&#x83B7;&#x53D6;&#x65F6;&#xFF0C;&#x5229;&#x7528;&#x53CD;&#x5C04;&#x83B7;&#x53D6;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x662F;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x7406;&#x60F3;&#x7684;&#x5904;&#x7406;&#x65B9;&#x5F0F;&#xFF0C;&#x5F53;&#x7136;&#xFF0C;&#x6211;&#x4EEC;&#x76F4;&#x63A5;&#x4E86;&#x89E3;&#x67D0;&#x4E2A;&#x7C7B;&#x7684;&#x67D0;&#x4E2A;&#x65B9;&#x6CD5;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x4E86;&#x89E3;&#x8FD4;&#x56DE;&#x6570;&#x636E;&#x7684;&#x7C7B;&#x578B;&#x662F;&#x8F83;&#x4E3A;&#x5E38;&#x89C4;&#x7684;&#x505A;&#x6CD5;&#xFF0C;&#x4F46;&#x8FD9;&#x79CD;&#x505A;&#x6CD5;&#x7684;&#x524D;&#x63D0;&#x662F;&#x8981;&#x5148;&#x4E86;&#x89E3;&#x518D;&#x8C03;&#x7528;&#x3002;</p>
<p>&#x53CD;&#x5C04;&#x9996;&#x5148;&#x8981;&#x83B7;&#x53D6;&#x8BE5;&#x7C7B;&#x7684;&#x7C7B;&#x578B;&#x4FE1;&#x606F;&#xFF0C;&#x7136;&#x540E;&#x901A;&#x8FC7;&#x8BE5;&#x7C7B;&#x578B;&#x4FE1;&#x606F;&#x5C31;&#x53EF;&#x4EE5;&#x5B8C;&#x6210;&#x5BF9;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x7684;&#x8BBF;&#x95EE;&#x3002;</p>
<p>&#x5047;&#x8BBE;&#x5B9E;&#x4F8B;&#x5316;&#x7684;&#x7C7B;&#x540D;&#x4E3A;ch8&#xFF0C;&#x83B7;&#x53D6;&#x7C7B;&#x578B;&#x4FE1;&#x606F;&#x5982;&#x4E0B;&#x3002;</p>
<p>Class class1=ch8.getClass();class1&#x7684;getAnnotation&#x65B9;&#x6CD5;&#x548C;getAnnotations&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x8BBF;&#x95EE;ch8&#x7C7B;&#x4E0A;&#x7684;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>getAnnotation&#x83B7;&#x53D6;&#x6307;&#x5B9A;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#xFF0C;getAnnotations&#x83B7;&#x53D6;&#x6240;&#x6709;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x901A;&#x8FC7;Class1&#x7684;getField&#x65B9;&#x6CD5;&#x8BBF;&#x95EE;ch8&#x7684;&#x6210;&#x5458;&#x5C5E;&#x6027;&#xFF0C;&#x6839;&#x636E;&#x8FD4;&#x56DE;&#x7684;Field&#x7C7B;&#x578B;&#x7684;&#x5BF9;&#x8C61;&#x7684;getAnnotation&#x65B9;&#x6CD5;&#x548C;getAnnotations&#x65B9;&#x6CD5;&#x8BBF;&#x95EE;&#x6210;&#x5458;&#x5C5E;&#x6027;&#x7684;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x901A;&#x8FC7;Class1&#x7684;getMethod&#x65B9;&#x6CD5;&#x8BBF;&#x95EE;ch8&#x7684;&#x6210;&#x5458;&#x65B9;&#x6CD5;&#xFF0C;&#x6839;&#x636E;&#x8FD4;&#x56DE;&#x7684;Method&#x7C7B;&#x578B;&#x7684;&#x5BF9;&#x8C61;&#x7684;getAnnotation&#x65B9;&#x6CD5;&#x548C;getAnnotations&#x65B9;&#x6CD5;&#x8BBF;&#x95EE;&#x6210;&#x5458;&#x5C5E;&#x6027;&#x7684;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-8 &#x8BBF;&#x95EE;&#x7C7B;&#x7684;&#x67D0;&#x4E2A;&#x6210;&#x5458;&#x65B9;&#x6CD5;&#x7684;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Annotation</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Documented</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">ElementType</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Retention</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Target</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>reflect<span class="token punctuation">.</span></span><span class="token class-name">Method</span><span class="token punctuation">;</span>
&#x3000;<span class="token annotation punctuation">@Documented</span>
&#x3000;<span class="token annotation punctuation">@Retention</span><span class="token punctuation">(</span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">.</span>RUNTIME<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@Target</span><span class="token punctuation">(</span><span class="token class-name">ElementType</span><span class="token punctuation">.</span>METHOD<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation8<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodname&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_8 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> aString<span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000; <span class="token keyword">try</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  ch11_8 ch8<span class="token operator">=</span><span class="token keyword">new</span> <span class="token function">ch11_8</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token class-name">Method</span> method<span class="token operator">=</span>ch8<span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getMethod</span><span class="token punctuation">(</span><span class="token string">&quot;getData1&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>            
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token class-name">Annotation</span> ans<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token operator">=</span>method<span class="token punctuation">.</span><span class="token function">getAnnotations</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token class-name">Annotation</span> annotation <span class="token operator">:</span> ans<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>annotation<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token punctuation">}</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token class-name">Annotation</span> annotation<span class="token operator">=</span>method<span class="token punctuation">.</span><span class="token function">getAnnotation</span><span class="token punctuation">(</span>testAnnoation8<span class="token punctuation">.</span><span class="token keyword">class</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>annotation<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token class-name">Exception</span> e<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;e<span class="token punctuation">.</span><span class="token function">printStackTrace</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@Deprecated</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@testAnnoation8</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;&#x7535;&#x6C60;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">getData1</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>        
&#x3000;    &#x3000; <span class="token punctuation">}</span>    
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x4ECE;&#x7B2C;09~15&#x884C;&#x81EA;&#x5B9A;&#x4E49;&#x4E86;&#x4E00;&#x4E2A;&#x6CE8;&#x89E3;testAnnoation&#x3002;</p>
<p>&#x7B2C;16~36&#x884C;&#x5B9A;&#x4E49;&#x4E86;&#x7C7B;ch11_8&#x3002;</p>
<p>&#x7B2C;32~35&#x884C;&#x5B9A;&#x4E49;&#x65B9;&#x6CD5;getData1&#xFF0C;&#x65B9;&#x6CD5;&#x4E0A;&#x6709;&#x4E24;&#x4E2A;&#x6CE8;&#x89E3;@Deprecated&#x548C;@testAnnoation8(name = &quot;&#x7535;&#x6C60;SOC&quot;, unit = &quot;%&quot;)&#x3002;</p>
<p>&#x7B2C;20&#x884C;&#x5B9A;&#x4E49;&#x4E86;ch11_8&#x7684;&#x5BF9;&#x8C61;ch8&#x3002;</p>
<p>&#x7B2C;21&#x884C;&#x8BBF;&#x95EE;ch8&#x7684;&#x6210;&#x5458;&#x65B9;&#x6CD5;getData1&#x3002;</p>
<p>&#x7B2C;22~25&#x884C;&#x8BBF;&#x95EE;getData1&#x65B9;&#x6CD5;&#x4E0A;&#x7684;&#x6240;&#x6709;&#x6CE8;&#x89E3;&#x3002;</p>
<p>&#x7B2C;26~27&#x884C;&#x8BBF;&#x95EE;&#x4E86;&#x6307;&#x5B9A;&#x6CE8;&#x89E3;testAnnoation8&#xFF0C;&#x6CE8;&#x610F;&#x6307;&#x5B9A;&#x6CE8;&#x89E3;&#x4F20;&#x9012;&#x7684;&#x53C2;&#x6570;&#x662F;testAnnoation8.class&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x7C7B;&#x7684;&#x7C7B;&#x578B;&#x4FE1;&#x606F;&#x5BF9;&#x8C61;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-8&#x7684;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;</p>
<p>@java.lang.Deprecated()@chapter11.testAnnoation8(unit=%, name=&#x7535;&#x6C60;SOC)@chapter11.testAnnoation8(unit=%, name=&#x7535;&#x6C60;SOC)&#x8303;&#x4F8B;11-9 &#x8BBF;&#x95EE;&#x7C7B;&#x7684;&#x67D0;&#x4E2A;&#x6210;&#x5458;&#x65B9;&#x6CD5;&#x7684;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Annotation</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Documented</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">ElementType</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Retention</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Target</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>reflect<span class="token punctuation">.</span></span><span class="token class-name">Method</span><span class="token punctuation">;</span>
&#x3000;<span class="token annotation punctuation">@Documented</span>
&#x3000;<span class="token annotation punctuation">@Retention</span><span class="token punctuation">(</span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">.</span>RUNTIME<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@Target</span><span class="token punctuation">(</span><span class="token class-name">ElementType</span><span class="token punctuation">.</span>METHOD<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation9<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodname&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_9 <span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> aString<span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000; <span class="token keyword">try</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000; ch11_9 ch9<span class="token operator">=</span><span class="token keyword">new</span> <span class="token function">ch11_9</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token class-name">Method</span> method<span class="token operator">=</span>ch9<span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getMethod</span><span class="token punctuation">(</span><span class="token string">&quot;getData1&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>            
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token class-name">Annotation</span> annotation<span class="token operator">=</span>method<span class="token punctuation">.</span><span class="token function">getAnnotation</span><span class="token punctuation">(</span>testAnnoation9<span class="token punctuation">.</span><span class="token keyword">class</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; testAnnoation9 t9<span class="token operator">=</span><span class="token punctuation">(</span>testAnnoation9<span class="token punctuation">)</span>annotation<span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;name value is &quot;</span><span class="token operator">+</span>t9<span class="token punctuation">.</span><span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">+</span><span class="token string">&quot;; unit is &quot;</span><span class="token operator">+</span>t9<span class="token punctuation">.</span><span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span><span class="token class-name">Exception</span> e<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;e<span class="token punctuation">.</span><span class="token function">printStackTrace</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@Deprecated</span>
&#x3000;    &#x3000; <span class="token annotation punctuation">@testAnnoation9</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;&#x7535;&#x6C60;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">getData1</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>        
&#x3000;    &#x3000; <span class="token punctuation">}</span>    
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;23&#x884C;&#x5C06;&#x6CE8;&#x89E3;&#x5F3A;&#x5236;&#x8F6C;&#x6362;&#x4E3A;testAnnoation9&#x3002;</p>
<p>&#x7B2C;24&#x884C;&#x8BBF;&#x95EE;&#x4E86;testAnnoation9&#x6CE8;&#x89E3;&#x7684;name&#x5C5E;&#x6027;&#x548C;unit&#x5C5E;&#x6027;&#xFF0C;&#x5E76;&#x6253;&#x5370;&#x5176;&#x503C;&#x3002;</p>
<p>&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;</p>
<p>name value is &#x7535;&#x6C60;SOC; unit is %11.5 &#x9AD8;&#x624B;&#x70B9;&#x62E8;&#x5F53;&#x8C03;&#x7528;&#x5927;&#x91CF;&#x65B9;&#x6CD5;&#xFF0C;&#x4E14;&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x503C;&#x548C;&#x7C7B;&#x578B;&#x8F83;&#x591A;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x53CD;&#x5C04;&#x548C;&#x6CE8;&#x89E3;&#x7B80;&#x5316;&#x7F16;&#x7A0B;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5BF9;&#x8303;&#x4F8B;11-9&#x8FDB;&#x884C;&#x6539;&#x9020;&#xFF0C;&#x5047;&#x8BBE;&#x8303;&#x4F8B;11-9&#x7684;getData&#x65B9;&#x6CD5;&#x6709;&#x5F88;&#x591A;&#xFF0C;&#x800C;&#x4E14;&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x7684;&#x4E2A;&#x6570;&#x548C;&#x8FD4;&#x56DE;&#x503C;&#x90FD;&#x4E0D;&#x540C;&#xFF0C;&#x5982;&#x8303;&#x4F8B;11-10&#x6240;&#x793A;&#x3002;</p>
<p>&#x8303;&#x4F8B;11-10 &#x8BBF;&#x95EE;&#x7C7B;&#x7684;&#x67D0;&#x4E2A;&#x6210;&#x5458;&#x65B9;&#x6CD5;&#x7684;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;</p>
<pre class="language-"><code class="lang-java"> <span class="token keyword">package</span> <span class="token namespace">chapter11</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Annotation</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Documented</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">ElementType</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Retention</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>annotation<span class="token punctuation">.</span></span><span class="token class-name">Target</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>lang<span class="token punctuation">.</span>reflect<span class="token punctuation">.</span></span><span class="token class-name">Method</span><span class="token punctuation">;</span>
&#x3000;<span class="token keyword">import</span> <span class="token namespace">java<span class="token punctuation">.</span>util<span class="token punctuation">.</span></span><span class="token class-name">ArrayList</span><span class="token punctuation">;</span>
&#x3000;
&#x3000;<span class="token annotation punctuation">@Documented</span>
&#x3000;<span class="token annotation punctuation">@Retention</span><span class="token punctuation">(</span><span class="token class-name">RetentionPolicy</span><span class="token punctuation">.</span>RUNTIME<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@Target</span><span class="token punctuation">(</span><span class="token class-name">ElementType</span><span class="token punctuation">.</span>METHOD<span class="token punctuation">)</span>
&#x3000;<span class="token annotation punctuation">@interface</span> testAnnoation10<span class="token punctuation">{</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;methodname&quot;</span><span class="token punctuation">;</span>
&#x3000;    &#x3000; <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">default</span> <span class="token string">&quot;unit&quot;</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> ch11_10 <span class="token punctuation">{</span>
&#x3000;      <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token keyword">throws</span> <span class="token class-name">Exception</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;ch11_10 ch9<span class="token operator">=</span><span class="token keyword">new</span> <span class="token function">ch11_10</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;<span class="token class-name">Method</span> method<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token operator">=</span>ch9<span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getMethods</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token class-name">Method</span> method2 <span class="token operator">:</span> method<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token class-name">Annotation</span> annotation<span class="token operator">=</span>method2<span class="token punctuation">.</span><span class="token function">getAnnotation</span><span class="token punctuation">(</span>testAnnoation10<span class="token punctuation">.</span><span class="token keyword">class</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token class-name">Class</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token operator">?</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> ts<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token operator">=</span>method2<span class="token punctuation">.</span><span class="token function">getParameterTypes</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token keyword">if</span> <span class="token punctuation">(</span>method2<span class="token punctuation">.</span><span class="token function">getName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">indexOf</span><span class="token punctuation">(</span><span class="token string">&quot;getData&quot;</span><span class="token punctuation">)</span><span class="token operator">==</span><span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token keyword">continue</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token class-name">ArrayList</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Object</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> params<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">ArrayList</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">Object</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token class-name">Class</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token operator">?</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> class1 <span class="token operator">:</span> ts<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token keyword">if</span> <span class="token punctuation">(</span>class1<span class="token punctuation">.</span><span class="token function">getSimpleName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">equals</span><span class="token punctuation">(</span><span class="token string">&quot;int&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;           params<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token keyword">if</span> <span class="token punctuation">(</span>class1<span class="token punctuation">.</span><span class="token function">getSimpleName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">equals</span><span class="token punctuation">(</span><span class="token string">&quot;String&quot;</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;          params<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token string">&quot;100&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>                    
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;    &#x3000;&#x3000;&#x3000; <span class="token keyword">if</span> <span class="token punctuation">(</span>annotation<span class="token operator">!=</span><span class="token keyword">null</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;&#x3000;&#x3000;&#x3000;testAnnoation10 t9<span class="token operator">=</span><span class="token punctuation">(</span>testAnnoation10<span class="token punctuation">)</span>annotation<span class="token punctuation">;</span>        
&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>t9<span class="token punctuation">.</span><span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">+</span><span class="token string">&quot; is &quot;</span><span class="token operator">+</span>method2<span class="token punctuation">.</span><span class="token function">invoke</span><span class="token punctuation">(</span>ch9<span class="token punctuation">,</span> params<span class="token punctuation">.</span><span class="token function">toArray</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token operator">+</span><span class="token string">&quot; &quot;</span><span class="token operator">+</span>t9<span class="token punctuation">.</span><span class="token function">unit</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;    &#x3000;&#x3000;&#x3000;  <span class="token punctuation">}</span>            
&#x3000;    &#x3000;&#x3000; <span class="token punctuation">}</span>            
&#x3000;      <span class="token punctuation">}</span>
&#x3000;      <span class="token annotation punctuation">@testAnnoation10</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;SOC&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;%&quot;</span><span class="token punctuation">)</span>
&#x3000;      <span class="token keyword">public</span> <span class="token keyword">int</span> <span class="token function">getData1</span><span class="token punctuation">(</span><span class="token keyword">int</span> a<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;<span class="token keyword">return</span> a<span class="token punctuation">;</span>
&#x3000;      <span class="token punctuation">}</span>
&#x3000;      <span class="token annotation punctuation">@testAnnoation10</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;Electricity&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;Ah&quot;</span><span class="token punctuation">)</span>
&#x3000;      <span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">getData2</span><span class="token punctuation">(</span><span class="token class-name">String</span> b<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;<span class="token keyword">return</span> b<span class="token punctuation">;</span>
&#x3000;      <span class="token punctuation">}</span>
&#x3000;      <span class="token annotation punctuation">@testAnnoation10</span><span class="token punctuation">(</span>name <span class="token operator">=</span> <span class="token string">&quot;Tempreture&quot;</span><span class="token punctuation">,</span> unit <span class="token operator">=</span> <span class="token string">&quot;&#x2103;&quot;</span><span class="token punctuation">)</span>
&#x3000;      <span class="token keyword">public</span> <span class="token keyword">int</span> <span class="token function">getData3</span><span class="token punctuation">(</span><span class="token keyword">int</span> a<span class="token punctuation">,</span><span class="token keyword">int</span> b<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;    &#x3000;&#x3000;<span class="token keyword">return</span> a<span class="token operator">+</span>b<span class="token punctuation">;</span>
&#x3000;      <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p> &#x4EE3;&#x7801;&#x8BE6;&#x89E3;&#x7B2C;11~17&#x884C;&#x5B9A;&#x4E49;&#x4E86;&#x6CE8;&#x89E3;testAnnoation10&#x3002;</p>
<p>&#x7B2C;41~42&#x884C;&#x4F7F;&#x7528;&#x4E86;&#x6CE8;&#x89E3;testAnnoation10&#xFF0C;&#x5E76;&#x5206;&#x522B;&#x7ED9;&#x6BCF;&#x4E2A;&#x6CE8;&#x89E3;&#x7684;&#x5C5E;&#x6027;&#x8D4B;&#x4E88;&#x4E86;&#x4E0D;&#x540C;&#x503C;&#xFF0C;getData1&#x662F;&#x201C;SOC&#x201D;&#xFF0C;getData2&#x662F;&#x201C;Electricity&#x201D;&#xFF0C;getData3&#x662F;&#x201C;Tempreture&#x201D;&#x3002;</p>
<p>&#x7B2C;21&#x884C;&#x83B7;&#x53D6;ch9&#x4E0A;&#x7684;&#x6240;&#x6709;&#x65B9;&#x6CD5;&#x3002;</p>
<p>&#x7B2C;23&#x884C;&#x83B7;&#x53D6;&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#x4E0A;&#x7684;testAnnoation10&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x7B2C;24&#x884C;&#x83B7;&#x53D6;&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x7C7B;&#x578B;&#x3002;</p>
<p>&#x7B2C;27~32&#x884C;&#x7ED9;&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x8D4B;&#x503C;&#x3002;</p>
<p>&#x7B2C;37&#x884C;&#x5229;&#x7528;&#x6CE8;&#x89E3;&#x4FE1;&#x606F;&#xFF0C;&#x6253;&#x5370;&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#xFF08;getData1&#x3001;getData2&#x3001;getData3&#xFF09;&#x6267;&#x884C;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x6CE8;&#x89E3;&#x4E2D;&#x7684;name&#x548C;unit&#x662F;&#x4E0D;&#x540C;&#x7684;&#x3002;</p>
<p>&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;</p>
<p>SOC is 10 %Electricity is 100 AhTempreture is 20 &#x2103;11.6 &#x5B9E;&#x6218;&#x7EC3;&#x4E60;&#x53C2;&#x7167;&#x8303;&#x4F8B;11-10&#xFF0C;&#x4FEE;&#x6539;&#x6CE8;&#x89E3;&#xFF0C;&#x4F7F;&#x5F97;&#x8C03;&#x7528;&#x8005;&#x53EF;&#x4EE5;&#x5229;&#x7528;&#x6CE8;&#x89E3;&#x5BF9;&#x65B9;&#x6CD5;&#x8FDB;&#x884C;&#x5206;&#x7C7B;&#xFF0C;&#x6253;&#x5370;&#x6BCF;&#x4E2A;&#x5206;&#x7C7B;&#x4FE1;&#x606F;&#x548C;&#x6BCF;&#x4E2A;&#x5206;&#x7C7B;&#x4E0B;&#x7684;&#x65B9;&#x6CD5;&#x53CA;&#x65B9;&#x6CD5;&#x6267;&#x884C;&#x7684;&#x7ED3;&#x679C;&#x3002;</p>
<p>&#xFF08;&#x63D0;&#x793A;&#xFF1A;&#x7ED9;&#x6CE8;&#x89E3;&#x52A0;&#x4E0A;category&#x5C5E;&#x6027;&#xFF0C;&#x5728;&#x4F7F;&#x7528;&#x6CE8;&#x89E3;&#x7684;&#x65F6;&#x5019;&#x7ED9;&#x6BCF;&#x4E2A;category&#x8D4B;&#x4E88;&#x7C7B;&#x522B;&#x503C;&#x5373;&#x53EF;&#xFF09;&#x3002;</p>

</div>

                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="java14.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 更灵活的设计--泛型">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"更强大和方便的功能--注解","level":"1.2.12","depth":2,"next":{"title":"设计实践--常用的设计模式","level":"1.2.13","depth":2,"ref":"","articles":[]},"previous":{"title":"更灵活的设计--泛型","level":"1.2.11","depth":2,"path":"java14.md","ref":"java14.md","articles":[]},"dir":"ltr"},"config":{"plugins":["simple-mind-map","new-flowchart","mermaid-gb3@2.1.0","hide-element","-lunr","-search","search-plus@^0.0.11","back-to-top-button","openwrite","code","prism","-highlight","-livereload","expandable-chapters","timeline","todo","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"timeline":{},"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"new-flowchart":{},"todo":{},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"openwrite":{"blogId":"18972-1576749538667-677","name":"谦谦君子","qrcode":"https://image.lichongbing.com/qrcode_for_gh_29bad7d68f3a_258.jpg","keyword":"更多"},"back-to-top-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"simple-mind-map":{"autoFit":true,"linkShape":"diagonal","preset":"colorful","style":{"height":"750px","wight":"1000px"},"type":"markdown"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"snowdreams1006","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Java笔记Blog","links":{"sidebar":{"blog":"https://blog.lichongbing.com/"}},"gitbook":"3.2.3","description":"gitbook-plugin-simple-mind-map examples"},"file":{"path":"java15.md","mtime":"2020-06-22T08:32:42.054Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-11-06T13:32:17.508Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    
    

    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-simple-mind-map/bundle.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-new-flowchart/raphael-min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-new-flowchart/flowchart-1.6.2.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-new-flowchart/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

<script src="https://my.openwrite.cn/js/readmore.js" type="text/javascript"></script>
<script>
var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
if (!isMobile) {
    var btw = new BTWPlugin();
    btw.init({
        "id": "vip-container",
        "blogId": "18972-1576749538667-677",
        "name": "谦谦君子",
        "qrcode": "https://image.lichongbing.com/qrcode_for_gh_29bad7d68f3a_258.jpg",
        "keyword": "更多"
    });
}
</script>

    <script src="gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>


    </body>
</html>

